import React, { useState, useEffect, useContext } from 'react'
import { Card as MyCard } from '&/appComponents/Antd'
import { Select, Spin } from 'antd'
import Echarts from '&/baseUI/EChartsUI'
import { getNewPlanLaunchAnalysisDisplay } from '&/api/electricity'
import { LayoutContext } from '@/pages/layouts/context'
import PlanMeasureCont3 from '@/views/PlanStart/Meaure/PlanMeasureCont3'
import './index.scss'
const WaterChart = () => {
  const [isLoading, setIsLoading] = useState(true)
  const [planData, setPlanData] = useState()
  const { activePlan } = useContext(LayoutContext)
  useEffect(() => {
    setIsLoading(true)
    getNewPlanLaunchAnalysisDisplay({
      plan_id: activePlan?.plan_id,
      start_time: activePlan?.start_time,
      end_time: activePlan?.end_time
    }).then((res) => {
      setIsLoading(false)
      setPlanData(res)
    })
  }, [activePlan?.plan_id])

  return (
    <Spin tip="Loading......" spinning={isLoading}>
      <PlanMeasureCont3 data={planData} />
    </Spin>
  )
}
export default WaterChart
